# import matplotlib.pyplot as plt
# import numpy as np

# x = np.array([5,7,8,7,2,17,2,9,4,11,12,9,6])
# y = np.array([99,86,87,88,111,86,103,87,94,78,77,85,86])
# plt.scatter(x, y, color = 'hotpink')

# x = np.array([2,2,8,1,15,8,12,9,7,3,11,4,7,14,12])
# y = np.array([100,105,84,105,90,99,90,95,94,100,79,112,91,80,85])
# plt.scatter(x, y, color = '#88c999')

# # plt.show()
# import matplotlib.pyplot as plt
# import numpy as np

# x = np.array(["Runoob-1", "Runoob-2", "Runoob-3", "C-RUNOOB"])
# y = np.array([12, 22, 6, 18])

# plt.barh(x,y)
# plt.show()




# import matplotlib.pyplot as plt
# import numpy as np

# x = np.array(["Runoob-1", "Runoob-2", "Runoob-3", "C-RUNOOB"])
# y = np.array([12, 22, 6, 18])

# plt.bar(x, y,  color = ["#4CAF50","red","hotpink","#E71010"])
# plt.show()


# import matplotlib.pyplot as plt
# import numpy as np

# y = np.array([35, 25, 25, 15])

# plt.pie(y)
# plt.show()


# import matplotlib.pyplot as plt
# import numpy as np

# y = np.array([35, 25, 25, 15])

# plt.pie(y,
#         labels=['A','B','C','D'], # 设置饼图标签
#         colors=["#d5695d", "#5d8ca8", "#65a479", "#a564c9"], # 设置饼图颜色
#         explode=(0, 0.2, 0.3, 0.1), # 第二部分突出显示，值越大，距离中心越远
#         autopct='%.2f%%', # 格式化输出百分比
#        )
# plt.title("RUNOOB Pie Test")
# plt.show()



import matplotlib.pyplot as plt
import numpy as np

# # 生成一组随机数据
# data = np.random.randn(1000)

# # 绘制直方图
# plt.hist(data, bins=30, color='skyblue', alpha=0.8)

# # 设置图表属性
# plt.title('RUNOOB hist() Test')
# plt.xlabel('Value')
# plt.ylabel('Frequency')

# # 显示图表
# plt.show()


# import matplotlib.pyplot as plt
# import numpy as np

# # 生成三组随机数据
# data1 = np.random.normal(0, 1, 1000)
# data2 = np.random.normal(2, 1, 1000)
# data3 = np.random.normal(-2, 1, 1000)

# # 绘制直方图
# plt.hist(data1, bins=30, alpha=0.5, label='Data 1')
# plt.hist(data2, bins=30, alpha=0.5, label='Data 2')
# plt.hist(data3, bins=30, alpha=0.5, label='Data 3')

# # 设置图表属性
# plt.title('RUNOOB hist() TEST')
# plt.xlabel('Value')
# plt.ylabel('Frequency')
# plt.legend()

# # 显示图表
# plt.show()
# import numpy as np
# import pandas as pd
# import matplotlib.pyplot as plt
 
# # 使用 NumPy 生成随机数
# random_data = np.random.normal(170, 10, 250)
 
# # 将数据转换为 Pandas DataFrame
# dataframe = pd.DataFrame(random_data)
 
# # 使用 Pandas hist() 方法绘制直方图
# dataframe.hist()


# # 设置图表属性
# plt.title('RUNOOB hist() Test')
# plt.xlabel('X-Value')
# plt.ylabel('Y-Value')

# # 显示图表
# plt.show()


# import matplotlib.pyplot as plt
# import numpy as np

# # 创建一个二维的图像数据
# img_data = np.random.random((100, 100))

# # 显示图像
# plt.imshow(img_data)

# # 保存图像到磁盘上
# plt.imsave('runoob-test.png', img_data)


# import matplotlib.pyplot as plt
# import numpy as np

# # 创建一幅灰度图像
# img_gray = np.random.random((100, 100))

# # 创建一幅彩色图像
# img_color = np.zeros((100, 100, 3))
# img_color[:, :, 0] = np.random.random((100, 100))
# img_color[:, :, 1] = np.random.random((100, 100))
# img_color[:, :, 2] = np.random.random((100, 100))

# # 显示灰度图像
# plt.imshow(img_gray, cmap='gray')

# # 保存灰度图像到磁盘上
# plt.imsave('test_gray.png', img_gray, cmap='gray')

# # 显示彩色图像
# plt.imshow(img_color)

# # 保存彩色图像到磁盘上
# plt.imsave('test_color.jpg', img_color)


import matplotlib.pyplot as plt

# 读取图像文件，下载地址：https://static.jyshare.com/images/mix/tiger.jpeg
img_array = plt.imread('tiger.jpeg')
tiger = img_array/255
#print(tiger)

# 显示图像
plt.figure(figsize=(10,6))

for i in range(1,5):
    plt.subplot(2,2,i)
    x = 1 - 0.2*(i-1)
    plt.axis('off') #hide coordinate axes
    plt.title('x={:.1f}'.format(x))
    plt.imshow(tiger*x)

plt.show()


